<?php

	class JieSuanChengGongController extends CommonController{

		public $model;

		public function __init(){
			parent:: __init();
			$this->model=K('Shop_oder_list');
		}

		public function index(){
			$tem =array();
			$tem['shijian'] =Q('post.shijian');
			$tem['pay_style'] =Q('post.pay_style');
			$explain = implode(',', $tem);
			// p($explain);
			$number = $_SESSION['number'];
			$oid = K('Shop_oder')->where("number='{$number}'")->getField('oid');
			if (!empty($_SESSION['cart']['goods'])) {
				$goods = $_SESSION['cart']['goods'];
				foreach ($goods as $k => $v) {
					$data = array(
						'shop_goods_gid' => $v['id'],
						'quantity' => $v['num'],
						'sub_total' => $v['total'],
						'explain'   => $explain,
						'shop_oder_oid'=>$oid,
						'jynum'     =>$k,
						'pic'       =>$v['options']['pic'],
						'price'     =>$v['price'],

						);
					$this->model->add($data);
				}

			}

			// p($_SESSION);
			// p($_POST);
			$total =$_SESSION['cart']['total']; 
			$this->assign('number',$number); 
			$this->assign('total',$total);

			$this->dis('jiesuanchenggong');
		}
	}





?>